package ah.szxy;

import ah.szxy.service.AccountService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 账户操作启动类
 *
 * @author caohaiyang
 * @create 2020-09-17 上午 10:53
 */
@SpringBootApplication
@EnableDiscoveryClient
@RestController
@MapperScan("ah.szxy.mapper")
public class AccountServiceApplication {

    @Autowired
    private AccountService accountService;

    public static void main(String[] args) {
        SpringApplication.run(AccountServiceApplication.class);
    }

    @GetMapping("/debit/{userName}/{money}")
    public ResponseEntity debit(@PathVariable("userName") String userName, @PathVariable("money") int money){
        accountService.debit(userName, money);
        return ResponseEntity.ok().build();
    }

}